package com.canal.collection;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter;

/**
 * 启动类
 * @author yangbo
 * @date 2020-06-29 16:11
 */
@SpringBootApplication
public class CanalCollectionApplication {

    public static void main(String[] args) {
        SpringApplication.run(CanalCollectionApplication.class,args);
    }

    @Bean
    public FilterRegistrationBean<OpenEntityManagerInViewFilter> registerOpenSessionInViewFilter() {
        FilterRegistrationBean<OpenEntityManagerInViewFilter> registrationBean = new FilterRegistrationBean<OpenEntityManagerInViewFilter>();
        OpenEntityManagerInViewFilter filter = new OpenEntityManagerInViewFilter();
        registrationBean.setFilter(filter);
        registrationBean.setOrder(5);
        return registrationBean;
    }
}
